package StudyCode.summary.mycollection;

import java.util.ArrayList;
import java.util.Collection;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class ConvertCollectionToArrayList {
	public static void main(String[] argv) {
		Collection col = java.util.Arrays.asList("科技与人文", "www.tah1986.com");
		System.out.println(toArrayList(col));
	}

	public static <K> ArrayList<K> toArrayList(Collection<K> col) {
		if (col == null) {
			return new ArrayList<K>();
		}
		ArrayList<K> result = new ArrayList<K>();
		for (K k : col) {
			result.add(k);
		}
		return result;
	}
}
